using WebAPI.Infrastructure.Persistence.Configuration.Base;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using WebAPI.Domain.Entity;

namespace WebAPI.Infrastructure.Persistence.Configuration
{
    public class AppUserConfiguration : BaseEntityConfiguration<AppUser>
    {
        public override void Configure(EntityTypeBuilder<AppUser> builder)
        {
            base.Configure(builder);

            //设置表名，查了老半天才查到原来设置表名方法是这个，残念。。。熬了个大夜
            builder.ToTable("app_user");

            builder.Property(x => x.Username).HasColumnName("username").HasMaxLength(2000).HasColumnOrder(1);
            builder.Property(x => x.Password).HasColumnName("password").HasMaxLength(2000).HasColumnOrder(2);
        }
    }
}